package com.ykt.converter;

import com.ykt.common.utils.DateUtil;
import com.ykt.vo.BaseVo;
import com.ykt.model.BaseModel;

/**
 * @author long.hua
 * @version 1.0.0
 * @since 2016-05-26 06:07
 */
public class BaseConverter {


    public static void convert(BaseVo vo, BaseModel model){
        if(model.getId() > 0){
            vo.setId(model.getId());
        }
        if(model.getName() != null){
            vo.setName(model.getName());
        }
        if(model.getCreatedTime() != null){
            vo.setCreatedTime(DateUtil.ymdhms2(model.getCreatedTime()));
        }
        if(model.getUpdatedTime() != null){
            vo.setUpdatedTime(DateUtil.ymdhms2(model.getUpdatedTime()));
        }
    }

}
